package cn.hx.mall.order.service.impl;

import cn.hx.mall.order.dao.OrderReturnApplyDao;
import cn.hx.mall.order.entity.OrderReturnApply;
import cn.hx.mall.order.service.OrderReturnApplyService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 订单退货申请(OrderReturnApply)表服务实现类
 *
 * @author makejava
 * @since 2022-11-25 14:14:12
 */
@Service("orderReturnApplyService")
public class OrderReturnApplyServiceImpl implements OrderReturnApplyService {
    @Resource
    private OrderReturnApplyDao orderReturnApplyDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public OrderReturnApply queryById(Long id) {
        return this.orderReturnApplyDao.queryById(id);
    }

    @Override
    public List<OrderReturnApply> queryByIdOrOrder(Long id) {
        return this.orderReturnApplyDao.queryByIdOrOrder(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<OrderReturnApply> queryAllByLimit(int offset, int limit) {
        return this.orderReturnApplyDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param orderReturnApply 实例对象
     * @return 实例对象
     */
    @Override
    public OrderReturnApply insert(OrderReturnApply orderReturnApply) {
        this.orderReturnApplyDao.insert(orderReturnApply);
        return orderReturnApply;
    }

    /**
     * 修改数据
     *
     * @param orderReturnApply 实例对象
     * @return 实例对象
     */
    @Override
    public OrderReturnApply update(OrderReturnApply orderReturnApply) {
        this.orderReturnApplyDao.update(orderReturnApply);
        return this.queryById(orderReturnApply.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.orderReturnApplyDao.deleteById(id) > 0;
    }

    @Override
    public int queryAll1(OrderReturnApply orderReturnApply) {
        return orderReturnApplyDao.queryAll1(orderReturnApply);
    }

    @Override
    public int updateStatus(OrderReturnApply orderReturnApply) {
        return orderReturnApplyDao.updateStatus(orderReturnApply);
    }

    @Override
    public List<Integer> selectStatus() {
        return orderReturnApplyDao.selectStatus();
    }

    @Override
    public List<OrderReturnApply> queryAll(OrderReturnApply orderReturnApply) {
        return orderReturnApplyDao.queryAll(orderReturnApply);
    }
}